#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int duplicateInArray(int* nums, int numsSize)
{
    int i = 0, j = 0, count = 0;
    for (i = 0; i < numsSize; i++)
    {
        count = 0;
        for (j = 0; j < numsSize; j++)
        {
            if (nums[i] == nums[j])
            {
                count++;
            }
        }
        if (count >= 2)
        {
            return nums[i];
        }
    }
    return -1;
}

int main()
{
    int arr[] = { 2, 3, 5, 4, 3, 2, 6, 7 };
    printf("%d\n", duplicateInArray(arr, 8));
    return 0;
}